package com.hww.DesignPattern.Adapter;

import com.hww.DesignPattern.Factory.Factory;
import com.hww.sort.ISortNumber;

/**
 * @author:Huangwenwei
 * @date:2014-6-20
 * @time:下午9:12:28
 */
public class PrintAdapter extends Printer implements ISortNumber {

	private ISortNumber mySort;

	public PrintAdapter(ISortNumber mySort) {
		super();
		this.mySort = mySort;
	}

	@Override
	public int[] sortASC(int[] intArray) {
		if (this.mySort != null) {
			return this.mySort.sortASC(intArray);
		} else
			return null;
	}

	/**
	 * @Time:下午9:12:28
	 * @Data:2014-6-20
	 * @Email:mr.huangwenwei@gmail.com
	 * @param args
	 * @Return:void
	 */
	public static void main(String[] args) {
		int[] array = new int[] { 4, 6, 4, 1, 8, 9, 64, 36, 85 };
		PrintAdapter adapter = new PrintAdapter(
				Factory.getOrderNumber(Factory.QUICK_SORT));
		adapter.printIntArray(adapter.sortASC(array));
	}

}
